Functions


Functions Summary
int

cot_auth_add_item(string module_name, string item_id, array auth_permit, array auth_lock)

Adds a new object into access control lists Usage example: $auth_permit = array( COT_GROUP_DEFAULT => 'R', COT_GROUP_GUESTS => '0',, COT_GROUP_MEMBERS => 'R', 12 => 'RW', // allows Read & Write for group with ID = 12 ); $auth_lock = array( COT_GROUP_DEFAULT => 'A', COT_GROUP_GUESTS => 'W12345A', COT_GROUP_MEMBERS => 'A', 12 => 'R', // cannot change Read for group with ID = 12 ); cot_auth_add_item('test', 'item123', $auth_permit, $auth_lock);

int

cot_auth_clear(mixed id)

Clears user permissions cache

int

cot_auth_getlevel(int userid, bool maingroup)

Returns highest level of all groups a user belongs to.

string

cot_auth_getmask(int rn)

Returns an access character mask for a given access byte

int

cot_auth_getvalue(string mask)

Converts an access character mask into a permission byte

int

cot_auth_remove_group(int group_id)

Removes a user group from auth table

int

cot_auth_remove_item(string module_name, string item_id)

Removes an object from ACL

void

cot_auth_reorder()

Optimizes auth table by sorting its rows

Function Detail

system\auth.php at line 92

cot_auth_add_item

public int cot_auth_add_item(string module_name, string item_id, array auth_permit, array auth_lock)
Adds a new object into access control lists Usage example: $auth_permit = array( COT_GROUP_DEFAULT => 'R', COT_GROUP_GUESTS => '0',, COT_GROUP_MEMBERS => 'R', 12 => 'RW', // allows Read & Write for group with ID = 12 ); $auth_lock = array( COT_GROUP_DEFAULT => 'A', COT_GROUP_GUESTS => 'W12345A', COT_GROUP_MEMBERS => 'A', 12 => 'R', // cannot change Read for group with ID = 12 ); cot_auth_add_item('test', 'item123', $auth_permit, $auth_lock);
Parameters:
module_name - The module object belongs to
item_id - Object identifier within the module
auth_permit - Allowed permissions map
auth_lock - Locked permissions map
Returns:
Number of rows inserted
Global:
CotDB $db

system\auth.php at line 127

cot_auth_clear

public int cot_auth_clear(mixed id)
Clears user permissions cache
Parameters:
id - User ID (int) or 'all'
Returns:
Number of items affected
Global:
CotDB $db
Cache $cache

system\auth.php at line 150

cot_auth_getlevel

public int cot_auth_getlevel(int userid, bool maingroup)
Returns highest level of all groups a user belongs to.
Parameters:
userid - User ID
maingroup - Return level of maingroup
Returns:

system\auth.php at line 169

cot_auth_getmask

public string cot_auth_getmask(int rn)
Returns an access character mask for a given access byte
Parameters:
rn - Permission byte
Returns:

system\auth.php at line 188

cot_auth_getvalue

public int cot_auth_getvalue(string mask)
Converts an access character mask into a permission byte
Parameters:
mask - Access character mask, e.g. 'RW1A'
Returns:

system\auth.php at line 217

cot_auth_remove_group

public int cot_auth_remove_group(int group_id)
Removes a user group from auth table
Parameters:
group_id - Group ID
Returns:
Number of records removed
Global:
CotDB $db

system\auth.php at line 232

cot_auth_remove_item

public int cot_auth_remove_item(string module_name, string item_id)
Removes an object from ACL
Parameters:
module_name - The module object belongs to
item_id - Object identifier within the module. If omitted, all objects will be removed.
Returns:
Number of records removed
Global:
CotDB $db

system\auth.php at line 245

cot_auth_reorder

public void cot_auth_reorder()
Optimizes auth table by sorting its rows
Global:
CotDB $db